package thread.synchroCode;

import lombok.extern.slf4j.Slf4j;

@Slf4j(topic = "c.Test2")
public class _06WaitNotify2 {
  private Boolean flag = true;
  private static Object lock= new Object();

  public static void main(String[] args) {

    Thread t1 = new Thread(() -> {
      synchronized (lock) {
        System.out.println("a");
      }
    });

    Thread t2 = new Thread(() -> {
      synchronized (lock) {
        System.out.println("b");
      }
    });

    t2.start();
    try {
      t2.join();
    } catch (InterruptedException e) {
      e.printStackTrace();
    }

    t1.start();
  }
}
